<template>
  <div  class="container">
      <div class="title">
        小爱<span>Admin</span>
      </div>
      <div>
        <!-- github logo  阿里矢量图 -->
        <i class="iconfont icon-github"></i>
        <i class="iconfont icon-qq"></i>
        <i class="iconfont icon-weixin"></i>
        <i class="iconfont">&#xe62b;</i>
        <i class="iconfont">&#xe689;</i>
        <i class="iconfont">&#xe8bb;</i>
        <!-- elementui 提供的使用方式 -->
        <i class="el-icon-sunny"></i>
        <!-- 使用本地图片 -->
        <!-- <img src="../assets/img/avatar.png" alt="">   -->
        <!-- <img style="width:30px;height:30px;" :src="avatar" alt=""> -->
        <img  style="width:30px;height:30px;" :src="require('../assets/img/avatar.png')" alt="">
        <el-dropdown  @command="handleCommand">
          <span class="el-dropdown-link">
            管理员 小张<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item command="a">个人信息</el-dropdown-item>
            <el-dropdown-item command="b">修改密码</el-dropdown-item>
            <el-dropdown-item command="c">退出</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
  </div>
</template>

<script>
import avatar from '../assets/img/avatar.png'
import { removeToken } from '../utils/cookieUtils'
export default {
  data(){
    return{
        avatar:avatar
    }
  },
  methods: {
      handleCommand(command) {
         console.log(command);
         if(command == 'c'){ //退出  清除token 不能使用重定向登陆页 正式发请求通知后端
            removeToken('token')
            // this.$router.go(0) //刷新页面
            window.location.href = '/#/login' //刷新跳转到/login
            //正式项目 发送请求
         }
      }
    }
}
</script>

<style lang="less" scoped>
.container{
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  width:100%;
  .title{
    font-size: 25px;
    span{
      color:red;
    }
  }
}
</style>